<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>注册审核</title>
    <jsp:include page="../../head.jsp"/>
</head>
<script type="text/javascript">
    var formSetting = {
        title: "注册审核",
        module: 'query',
        numCount: '3',
        columns: [{
            index: "comName",
            name: "comName",
            label: "公司名称"
        }, {
            index: "comUniteCode",
            name: "comUniteCode",
            label: "统一社会信用代码"
        }, {
            index: "comCustomCode",
            name: "comCustomCode",
            label: "海关企业注册代码"
        }, {
            index: "registerTimeBegin",
            name: "registerTimeBegin",
            label: "注册时间起",
            type:'date'
        }, {
            index: "registerTimeEnd",
            name: "registerTimeEnd",
            label: "注册时间至",
            type:'date'
        }, {
            index: "auditTimeBegin",
            name: "auditTimeBegin",
            label: "审核时间起",
            type:'date'
        }, {
            index: "auditTimeEnd",
            name: "auditTimeEnd",
            label: "审核时间至",
            type:'date'
        }, {
            index: "status",
            name: "status",
            type: "dropdown",
            data: [["待审核", "0"], ["通过", "1"], ["不通过", "2"]],
            label: "审核状态"
        }, {
            index: "comType",
            name: "comType",
            type: "dropdown",
            data: [["客户", "CL"], ["报关行", "CC"], ["隐性客户", "0"]],
            label: "公司类型"
        }, {
            index: "registerType",
            name: "registerType",
            type: "dropdown",
            data: [["全部", "9"], ["直接注册", "1"], ["委托注册", "0"]],
            label: "注册方式"
        }],
        buttons: {
            custom: [{
                id: "auditBtn",
                value: "审核",
                click: function () {
                    var rowData = $("#auditDataGrid").gridMethods().getSelectRow();
                    if (!jQuery.isEmptyObject(rowData)) {
                        if(rowData.comType === '0'){
                            location.href = "<s:url value='/business/cominfo/toAuditCom'/>?registerType="+rowData.registerType+"&auditId=" + rowData.auditId ;
                        }else{
                            location.href = "<s:url value='/registered/approve-platformApprove'/>?reg_company_id=" + rowData.auditId ;
                        }
                    } else {
                        layer.msg("请选择要审核的记录");
                    }
                }
            }]
        },
        grid: {
            id: "auditDataGrid",
            title: "查询结果",
            url: "auditMainData",
            colModel: [{
                index: "auditId",
                name: "auditId",
                label: "auditId",
                hidden: true
            },{
                index: "arefId",
                name: "arefId",
                label: "arefId",
                hidden: true
            }, {
                index: "comType",
                name: "comType",
                hidden: true
            }, {
                index: "comName",
                name: "comName",
                label: "公司名称"
            }, {
                index: "comUniteCode",
                name: "comUniteCode",
                label: "统一社会信用代码"
            }, {
                index: "comCustomCode",
                name: "comCustomCode",
                label: "海关企业注册代码"
            }, {
                index: "registerType",
                name: "registerType",
                label: "注册方式",
                formatter:function(val, opts, row){
                    if(val === undefined || val === "null"){
                        return ""
                    }
                    if("1" === val){
                        return "直接注册"
                    }else if("0" === val){
                        return "委托注册"
                    }else{
                        return val;
                    }
                }
            }, {
                index: "agentComName",
                name: "agentComName",
                label: "代录单人"
            }, {
                index: "recommendSup",
                name: "recommendSup",
                label: "推荐报关行"
            }, {
                index: "registerTime",
                name: "registerTime",
                label: "注册时间"
            }, {
                index: "supAuditStatus",
                name: "supAuditStatus",
                label: "报关行审核状态"
            }, {
                index: "pmanagerAuditStatus",
                name: "pmanagerAuditStatus",
                label: "平台审核状态"
            }, {
                label: "操作",
                sortable: false,
                buttons: [{
                    key: "attachmentDelBtn",
                    value: "查看联系人",
                    click: function (gridid, rowId, rowdata) {
                        viewContracts(rowdata.arefId);
                    },
                    hide: function (rowdata) {
                        return rowdata.arefId === undefined;
                    }
                }],
                formatter: $.jqGrid.custom.formatter.button
            }],
            sortname: "registerTime",
            sortorder: "desc"
        }
    };

    function viewContracts(arefId) {
        layer.open({
                       type: 2,
                       title: false,
                       content: "<s:url value='/tGenComContact/listPageInFrame'/>?agentRefId=" + arefId,
                       area: ['840px', '400px']
                   });
    }
    $(document).ready(function () {
        $("#auditTable").mrdForm(formSetting);
    });
</script>
<body>
<div id="auditTable"></div>
</body>
</html>
